package cn.hchaojie.camp.day06;

// 内部类可以直接访问外部类的成员变量


public class Shape {
	protected int type = 1;

	private Point center;
	
	public void print() {
		System.out.println("外部类的print。。。");
	}
	
	public static class Color {
		private String name = "红色";
		private double alpha = 1;
		
		public void print() {
			// 静态内部类，访问不了外部类的实例变量（成员变量）
			// System.out.println(type);
		}
	}
	
	public class Point {
		private double doubleX;
		private double doubleY;
		private int type = 2;
		
		public Point() {
			
		}
		
		public Point(double x, double y) {
			this.doubleX = x;
			this.doubleY = y;
			
			// 可以访问, type是外部类的成员变量
			System.out.println(type);
		}
		
		public void print() {
			// 显式的指定外部类
			Shape.this.print();
			
			System.out.println(Shape.this.type);
			System.out.println(this.type);
		}
	}
}
